using UnityEngine;
using System.Collections;

public class HunterScript : MonoBehaviour {
	
	public Transform target;
	private Transform myTransform;
	public float speed = 2.0f;	

	// Use this for initialization
	void Start () {
		target = GameObject.FindWithTag("Player").transform;	
	}
	
	void Awake(){
		myTransform = transform;		
	}
	
	// Update is called once per frame
	void Update () {
		if(target.position.x>myTransform.position.x-20)
			myTransform.position += myTransform.right * speed * Time.deltaTime;
		else
			myTransform.position += -myTransform.right * speed * Time.deltaTime;	
	}
}
